<template>
  <el-row>
    <el-col :span="14">
      <img style="width: 80%; height: 80%" src="../assets/logo.png"
    /></el-col>
    <el-col :span="10">
      <div class="login_title">酒店管理系统2</div>

      <el-form ref="form" :model="params" label-width="80px" style="margin:10px;">
        <el-form-item label="用户名">
          <el-input v-model="params.usrNo" clearable></el-input>
        </el-form-item>

        <el-form-item label="密码">
          <el-input v-model="params.passwod" type="password"></el-input>
        </el-form-item>

        <el-form-item>
          <el-button type="primary" @click="onSubmit">登录</el-button>
          <el-button>取消</el-button>
        </el-form-item>
      </el-form>
    </el-col>
  </el-row>
</template>

<script>
import axios from "axios";

export default {
  name: "login",
  components: {},
  computed: {},
  data() {
    return {
      params: {
        usrNo: "",
        passwod: "",
      },
    };
  },
  methods: {
    onSubmit() {
      axios({
        baseURL: "/api",
        method: "post",
        url: "/login/login",
        params: this.params, // String usrNo, String passwod
        // data: this.params, @RequestBody LoginDto login
      }).then((res) => {
        console.info(res);
        if (res.data == "登录成功") {
          this.$router.push("/main/index");
        } else {
          this.$message.error(res.data);
        }
      });
    },
  },
};
</script>

<style>
.login_title {
  display: flex;
  font-size: 32px;
  font-weight: bold;
  height: 200px;
  align-items: center;
  justify-content: center;
}
</style>
